import { _decorator, Component, Node } from 'cc';
import { GlobalTmpData } from '../../../Init/Config/GlobalTmpData';
const { ccclass, property } = _decorator;

@ccclass('ExchangeBtns')
export class ExchangeBtns extends Component {

    @property
    offsetX = 167;

    count = 0;
    onEnable() {
        if (!GlobalTmpData.isMiscontact) return;
        //交换位置
        if (this.count % 2 == 0) {
            this.node.children[0].setPosition(this.offsetX, 0, 0);
            this.node.children[1].setPosition(-this.offsetX, 0, 0);
        } else {
            this.node.children[0].setPosition(-this.offsetX, 0, 0);
            this.node.children[1].setPosition(this.offsetX, 0, 0);
        }

        this.count++;
    }
}

